<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title> new document </title>
 </head>
 <body>
	<!--输入三角形行数：<input id="inp" />
	<button id="but">确定</button>-->
	<script type="text/javascript">
		/*var inp = document.getElementById('inp');
		var but = document.getElementById('but');
		but.onclick = function(){
			alert('行数为：'+inp);
		}*/
		/*var star = prompt('输入三角形行数：');
		for(var i=0;i<star;i++){
			for(var r=0;r<=i;r++){
				document.write('&nbsp;*');
			}
			document.write("<br/>");
		}
		document.write("<br/>");
		for(var i=0;i<star;i++){
			for(var r=star;r>i;r--){
				document.write('&nbsp;*');
			}
			document.write("<br/>");
		}
		document.write("<br/>");
		for(var i=0;i<star;i++){
			for(var r=0;r<=i;r++){
				document.write('&nbsp;');
			}
			for(var r=star;r>i;r--){
				document.write(' *');
			}
			document.write("<br/>");
		}
		document.write("<br/>");
		for(var i=0;i<star;i++){
			for(var r=star;r>i;r--){
				document.write('&nbsp;');
			}
			for(var r=0;r<=i;r++){
				document.write(' *');
			}
			document.write("<br/>");
		}
		document.write("<br/>");*/
		
		var star = prompt('输入菱形总行数(基数)：');
		for(var a=1;a<=star;a++){ 
			for(var b=1;b<=star;b++){
				 if(a+b>=6&a+b<=14&a-b<=4&b-a<=4){//3  3  5  1  1
					document.write("* ");		  //5  4  8  2  2
				}else {							  //7  5  11 3  3
					document.write("&nbsp;");	  //9  6  14 4  4 
			}
		}document.write("<br>");	
		}
		
		
		 
	</script>
 </body>
</html>
